<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <title>admin</title>
</head>
<body style="padding: 0 8px;">

<h2>
    <%= aname %>
</h2>

<a class="btn btn-primary" href="/index/duang/export?aid=<%= aid %>" target="_blank">导出csv</a>
<% for(var i = 0; i < active.length; i++){
if(active[i].id != aid) { %>

<a class="btn btn-success" href="/index/duang?aid=<%= active[i].id %>&page=1&step=10">进入:<%= active[i].name %></a>
<% }} %>
<h4>共 <%= allpage %> 页 共<%= count %> 条记录 当前第 <%= page %> 页</h4>
<div>
    <table class="table table-bordered">
        <thead>
        <th>ID</th>
        <th>姓名</th>
        <th>手机号</th>
        <th>地址</th>
        <th>图片</th>
        <th>奖品名</th>
        <th>数码</th>
        <th>创建时间</th>
        </thead>
        <tbody>
        <% for(var i = 0; i < data.length; i++){ %>
        <tr>
            <td><%= data[i].id %></td>
            <td><%= data[i].name %></td>
            <td><%= data[i].phone %></td>
            <td><%= data[i].address %></td>
            <td><a href="<%= data[i].img_url %>"><%= data[i].img_url %></a></td>
            <td><%= data[i].pname %></td>
            <td><%= data[i].ac_code %></td>
            <td><%= data[i].createdAt %></td>
        </tr>
        <% } %>
        </tbody>
    </table>
</div>
<% if(allpage != 0){ %>
<div>
    <% if(page != 1) { %>
    <a style="float:left;" href="/index/duang?aid=<%= aid %>&page=<%= page - 1 %>&step=<%= step %>" class="btn btn-primary">上一页</a>
    <% } %>
    <% if(page != allpage){ %>
    <a style="float:left;" href="/index/duang?aid=<%= aid %>&page=<%= page + 1 %>&step=<%= step %>" class="btn btn-primary">下一页</a>
    <% } %>
    <form style="float:left;" class=" col-xs-1 col-sm-1 col-md-1 col-lg-1">
        <div class="form-group">
            <input type="text" class="form-control" id="page">
        </div>
    </form>
    <a style="float:left;" href="javascript:;" class="btn btn-primary " id="btn-go">GO</a>
    <div style="clear:both;"></div>
</div>
<% } %>
<div>
</div>
<script src="/js/jquery.min.js"></script>
<script>
    $("#btn-go").on("click", function () {
        var page = parseInt($("#page").val());
        if (!page) {
            return alert("请输入页数");
        }

        if (page <= 0) {
            return alert("请输入大于0的数字");
        }

        if (page > <%= allpage %>) {
            page = <%= allpage %>
        }

        window.location.href = "/index/duang?aid=<%= aid %>&page=" + page + "&step=<%= step %>";
    });
</script>
</body>
</html>